﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //double a = 1, b = 2;
            //Lfit.SWAP(ref a,ref b); 
            double[] x, y;
            int n = 5;
            x = Lfit.vector(n);
            y = Lfit.vector(n);
            double[] result = Lfit.vector(3);//3 chi
            int[] w = new int[n];
            double r2 = 0;
            for (int i = 0; i < n; i++)
            {
                x[i] = i+1; y[i] =3*x[i]*x[i]+x[i]*2+5; w[i] = 1;
            }
            Lfit.lfit(x,y,w,n,ref result,3,ref r2);
        }
    }
}
